package com.example.mapp;

import com.example.entity.authority.UsedPartyDetail;
import org.apache.ibatis.annotations.*;

/**
 * Created by simon on 2017/10/1.
 */
@Mapper
public interface UsedPartyDetailMapp {


    @Select(" select * from used_party_detail  where party_id=#{partyId}")
    public UsedPartyDetail queryById(String partyId) throws Exception;

    @Insert(" insert into used_party_detail " +
            "(business_scope,elevator_num," +
            "legal_person_name,legal_person_phone,operator_num," +
            "party_id,safety_person_name,safety_person_phone," +
            "special_equipment_accidents,zzjb,zzs_url,czry_num) " +
            "value (#{businessScope},#{elevatorNum},#{legalPersonName},#{legalPersonPhone}," +
            "#{operatorNum},#{partyId},#{safetyPersonName},#{safetyPersonPhone}" +
            ",#{specialEquipmentAccidents},#{zzjb},#{zzsUrl},#{czryNum})")
    @SelectKey(statement="select last_insert_id()",keyProperty = "id",keyColumn = "id",before = false,resultType = Long.class)
    public int add(UsedPartyDetail usedPartyDetail) throws Exception;

    @Update(" update used_party_detail set " +
            "business_scope=#{businessScope},elevator_num=#{elevatorNum}," +
            "legal_person_name=#{legalPersonName},legal_person_phone=#{legalPersonPhone},operator_num=#{operatorNum}," +
            "party_id=#{partyId},safety_person_name=#{safetyPersonName},safety_person_phone=#{safetyPersonPhone}," +
            "special_equipment_accidents=#{specialEquipmentAccidents},zzjb=#{zzjb},zzs_url=#{zzsUrl},czry_num=#{czryNum} where id=#{id} ")
    public int update(UsedPartyDetail usedPartyDetail) throws Exception;

}
